<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title>公司认证</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/mui.dtpicker.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <link type="text/css" href="../../css/mui.picker.css" rel="stylesheet"/>
    <link type="text/css" href="../../css/mui.poppicker.css" rel="stylesheet"/>
    <style>
        body {
            background: #f3f3f3;
            font-size: 14px;
        }

        input[type="text"], input[type="number"], input[type="tel"] {
            margin-bottom: 0;
            border: none;
            padding-top: 1px;
        }

        .aui-list-view-cell {
            vertical-align: middle;
            padding: 0px 15px;
        }

        .aui-list-view {
            margin-bottom: 0;
        }

        .aui-arrow-right:after {
            content: "";
        }

        .rzTitle {
            width: 88px;
            float: left;
            vertical-align: middle;
            height: 45px;
            line-height: 45px;
        }

        .rzInput {
            width: calc(100% - 88px);
            float: left;
            height: 45px;
            line-height: 45px;
        }

        .RegMeg {
            padding: 8px 15px;
            font-size: 13px;
        }

        .btn {
            border: none;
            background: #ccc;
            padding: 15px;
            text-align: center;
            font-size: 18px;
            color: #fff;
            font-weight: bold;
            border-radius: 5px;
            margin-top: 18px;
        }

        .time {
            width: 100%;
            height: 45px;
            padding-left: 15px;
            color: #9c9c9c;
            font-size: 14px;
        }

        input {
            font-size: 14px;
        }

        .picGroup {
            text-align: center;
            background: #f5f5f5;
            padding: 5px;
            width: 100%;
            /*float: left;*/
            display: table;
            height: 120px;
            margin-bottom: 10px;
        }

        .picGroupCell {
            /*display: table-cell;*/
            vertical-align: middle;
            margin-top: 15px;

        }

        .picGroupCell > img {
            width: 240px;
        }

        .pic {
            max-height: 145px;
            overflow: hidden;
            padding-bottom: 0;
            padding: 0;
            width: 100px;
            margin: 0 auto;
        }

        .liInfoPIc.pic {
            max-height: 270px;
            overflow: hidden;
            padding-bottom: 0;
        }

        .picList li {
            max-height: 140px;
            /* overflow: hidden; */
            width: 100%;
            margin-right: 2%;
            float: left;
            margin-bottom: 28px;
            position: relative;

        }

        .pic.validate:after {
            border: 0;
        }

        .picList li img {
            width: 100%;
            max-height: 120px;
        }

        .picList li:nth-of-type(3n) {
            margin-right: 0;
        }

        #comIntrol, #address {
            margin-bottom: 0;
            border: none;
            padding-top: 1px;
            height: 100px;
            padding-top: 12px;
            font-size: 14px;
        }

        .colorBlack {
            color: #000 !important;
        }
    </style>
</head>
<body>
<div class="contain">
    <!--<ul class="aui-list-view">-->
    <!--<li class="aui-list-view-cell">-->
    <!--<div class="aui-arrow-right rzTitle">身份认证</div>-->
    <!--<div class="aui-arrow-right rzInput"><input title="正确身份证" type="text" class="validate"   placeholder="请输入您的身份证号码" id="idCard" oninput="checkID(this)" onpropertychange="checkID(this)"></div>-->
    <!--</li>-->
    <!--</ul>-->
    <div class="RegMeg">工商注册信息</div>
    <ul class="aui-list-view messageList">
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">公司名称</div>
            <div class="aui-arrow-right rzInput"><input type="text" class="validate" placeholder="请输入公司名称"
                                                        id="companyName"
                                                        oninput="checkNull(this),setAutLocalstorage(this)"
                                                        onpropertychange="checkNull(this),setAutLocalstorage(this)">
            </div>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">公司电话</div>
            <div class="aui-arrow-right rzInput"><input type="tel" class="validate" placeholder="请输入公司电话"
                                                        id="companyPhonne"
                                                        oninput="checkNull(this),setAutLocalstorage(this)"
                                                        onpropertychange="checkNull(this),setAutLocalstorage(this)">
            </div>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">注册资本(万)</div>
            <div class="aui-arrow-right rzInput"><input type="number" class="validate" placeholder="请输入公司注册资本(万)"
                                                        id="companyMoney"
                                                        oninput="checkNull(this),setAutLocalstorage(this)"
                                                        onpropertychange="checkNull(this),setAutLocalstorage(this)">
            </div>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">公司规模(人)</div>
            <div class="aui-arrow-right rzInput"><input type="number" class="validate" placeholder="请输入公司规模(人)"
                                                        id="companyPeople"
                                                        oninput="checkNull(this),setAutLocalstorage(this)"
                                                        onpropertychange="checkNull(this),setAutLocalstorage(this)">
            </div>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">公司类型</div>
            <div class="aui-arrow-right rzInput">
                <div class="time validate popChoose" id="comType" tapmode onclick="chooseComType(this)">请选择公司类型</div>
            </div>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">经营模式</div>
            <div class="aui-arrow-right rzInput">
                <div class="time validate popChoose" id="modelType" tapmode onclick="chooseModel(this)">请选择经营模式</div>
            </div>
        </li>


        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">所在地区</div>
            <div class="aui-arrow-right rzInput">
                <div class="time validate popChoose" id="area" tapmode onclick="openToChoose(this)">请选择所在地区</div>
            </div>
        </li>

        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">主营行业</div>
            <div class="aui-arrow-right rzInput" style="height: auto;line-height: 20px;padding: 12px 0;">
                <div class="time validate popChoose" id="mainType" tapmode onclick="openToTwo('comAutCategoryList_win')"
                     style="height: auto;display: table;">请选择主营行业
                </div>
            </div>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">经营范围</div>
            <div class="aui-arrow-right rzInput"><input oninput="checkNull(this),setAutLocalstorage(this)"
                                                        onpropertychange="checkNull(this),setAutLocalstorage(this)"
                                                        type="text" class="validate" placeholder="请输入经营范围"
                                                        id="jingying"></div>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">成立日期</div>
            <div class="aui-arrow-right rzInput">
                <!--用div防止弹出输入框 <input type="text" placeholder="请输入成立日期" id="startTime"> -->
                <div class="time validate popChoose" id="startTime" tapmode onclick="openToChoose(this)">请输入成立日期</div>
            </div>
        </li>

        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">公司地址</div>
            <div class="aui-arrow-right rzInput" style="height: 100px;"><textarea
                    oninput="checkNull(this),setAutLocalstorage(this)"
                    onpropertychange="checkNull(this),setAutLocalstorage(this)"
                    class="validate" placeholder="请输入公司地址"
                    id="address"></textarea></div>
        </li>


        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle">公司介绍</div>
            <div class="aui-arrow-right rzInput" style="height: 100px;"><textarea
                    oninput="checkNull(this),setAutLocalstorage(this)"
                    onpropertychange="checkNull(this),setAutLocalstorage(this)"
                    class="validate"
                    placeholder="请输入公司介绍,不能少于10个字"
                    id="comIntrol"></textarea></div>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle" style="float: none;width: 120px;">身份证或营业执照</div>
            <ul>
                <li class="aui-list-view-cell pic  validate">
                    <ul class="picList deleUl ulSlidePic" id="id-upload" tapmode onclick="add_pic('id-upload', 1,this)">
                    </ul>
                    <div class="picGroup " tapmode data-type="slidePic" onclick="add_pic('id-upload', 1,this)">
                        <div class="picGroupCell">
                            <p><img src="../../image/addPic.png"></p>

                            <p>添加图片</p>

                            <p><em class="picNum">0</em>/1</p>
                        </div>
                    </div>
                </li>
            </ul>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle" style="float: none;">公司LOGO</div>
            <ul>
                <li class="aui-list-view-cell pic  validate">
                    <ul class="picList deleUl ulSlidePic" id="logo-upload" tapmode
                        onclick="add_pic('logo-upload', 1,this)">
                        <!--<li><img src="../../image/tese.jpg"></li>-->
                        <!--<li><img src="../../image/tese.jpg"></li>-->
                        <!--</li>-->
                        <!--<li><img src="../../image/tese.jpg"></li>-->
                    </ul>
                    <div class="picGroup " data-type="slidePic" tapmode onclick="add_pic('logo-upload', 1,this)">
                        <div class="picGroupCell">
                            <p><img src="../../image/addPic.png"></p>

                            <p>添加图片</p>

                            <p><em class="picNum">0</em>/1</p>
                        </div>
                    </div>
                </li>
            </ul>
        </li>
        <li class="aui-list-view-cell">
            <div class="aui-arrow-right rzTitle" style="float: none;">公司背景图片</div>
            <ul>
                <li class="aui-list-view-cell pic  validate">
                    <ul class="picList deleUl ulSlidePic" id="bg-upload" tapmode
                        onclick="add_pic('logo-upload', 1,this)">
                    </ul>
                    <div class="picGroup " tapmode data-type="slidePic" onclick="add_pic('bg-upload', 1,this)">
                        <div class="picGroupCell">
                            <p><img src="../../image/addPic.png"></p>

                            <p>添加图片</p>

                            <p><em class="picNum">0</em>/1</p>
                        </div>
                    </div>
                </li>
            </ul>
        </li>
    </ul>
</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script>
<script type="text/javascript" src="../../script/echo.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/index.js"></script>
<script type="text/javascript" src="../../script/myInfo.js"></script>
<script type="text/javascript" src="../../script/jquery-1.11.3.js"></script>
<!-- 时间 -->
<script type="text/javascript" src="../../script/city.data-3.js"></script>
<script type="text/javascript" src="../../script/mui.min.js"></script>
<script type="text/javascript" src="../../script/mui.poppicker.js"></script>
<script type="text/javascript" src="../../script/mui.dtpicker.js"></script>
<script type="text/javascript" src="../../script/mui.picker.js"></script>
<!--  <script type="text/javascript" src="../../script/mui.poppicker.js"></script> -->
<script type="text/javascript">
    var imgUrl, imageNum = 0;
    var imgType = "";
    var thumb, bgurl;
    var imageLen = 0, imageSendIndex = 0;
    var areaText, areaCityId;//经营所以区域
    var addressText, addressCityId;//公司所在地址
    var startTime = "";
    var comType = "";
    var imgs = "";
    var categorys, categoryIds;
    var mainType = "";//主营行业
    var modelType = "";
    apiready = function () {
        api.parseTapmode();
        // getData();

        //加载本地缓存
        loadStorageData();
        setTimeout(function () {
            checkCanSumbit();
        },1000)
        //重新登录监听
        api.addEventListener({
            name: 'reGetMyInfo'
        }, function (ret) {
            if (ret && ret.value) {
                page = 1;
                getData();
            }
        });
        api.addEventListener({
            name: 'hasChoose'
        }, function (ret) {
            if (ret && ret.value) {
                switch (ret.value.type) {
                    case "area":
                        areaText = ret.value.city;
                        areaCityId = ret.value.cityCode;
                        $api.setStorage("_area", areaText);
                        $api.setStorage("_areaId", areaCityId);
                        $("#area").text(areaText);
                        $("#area").removeClass("validate");
                        $("#area").addClass("colorBlack");
                        break;
                    case "startTime":
                        startTime = ret.value.time;
                        $("#startTime").text(startTime);
                        $api.setStorage("_startTime", startTime);
                        $("#startTime").removeClass("validate");
                        $("#startTime").addClass("colorBlack");
                        break;
                    case "category":
                        categorys = ret.value.categorys;
                        categoryIds = ret.value.categoryIds;
                        $api.setStorage("_mainType", categorys);
                        $api.setStorage("_mainTypeId", categoryIds);
                        $("#mainType").text(categorys);
                        $("#mainType").removeClass("validate");
                        $("#mainType").addClass("colorBlack");
                        break;

                }
            }

        });
    }
    //设置缓存，根据id来设置名字
    function setAutLocalstorage(obj) {
        var strorageName = "_" + $(obj).attr("id");
        $api.setStorage(strorageName, $(obj).val())
    }
    function loadStorageData() {
        //赋值给input输入框
        $(".messageList").find("input,textarea").each(function () {
            var inputId = $(this).attr("id");
            var value = $api.getStorage("_" + inputId);
            if ((typeof (value)!= "undefined") && (value!="")) {
                $(this).removeClass("validate");
                $(this).val(value)
            }
        })
        //赋值弹出选择的那些
        $(".messageList").find(".popChoose").each(function () {
            var popChooseId = $(this).attr("id");
            var value = $api.getStorage("_" + popChooseId);
            if ((typeof (value) != "undefined")&& (value!="")) {
                $(this).removeClass("validate");
                $(this).text(value)
                $(this).addClass("colorBlack");
            }
        })
        //赋值图片
        $(".messageList").find(".picList").each(function () {
            var picListId = $(this).attr("id");
            var value = $api.getStorage("_" + picListId);
            if ((typeof (value) != "undefined")&& (value!="")) {
                $(this).closest("li").removeClass("validate");

                $(this).html(' <li><img class="pics" src="' + value + '"></li>')
            }
        })


//        $("#companyName").val($api.getStorage("_companyName"));
//        $("#companyPhonne").val($api.getStorage("_companyPhonne"));
//        $("#companyName").val($api.getStorage("_companyName"));
//        $("#companyName").val($api.getStorage("_companyName"));
    }
    $("#endtTime").click(function () {
        var obj = this;
        var date = new Date();
        var beginYear = date.getFullYear() - 10;
        var endYear = date.getFullYear() + 5;
        var options = '{"type":"date","beginYear":' + beginYear + ',"endYear":' + endYear + '}';
        var dtPicker = new mui.DtPicker(JSON.parse(options));
        dtPicker.show(function (selectItems) {
            $("#endtTime").text(selectItems);
            $(obj).removeClass("validate");
            checkCanSumbit();
            dtPicker.dispose();
        })
    })
    //检查身份证
    function checkID(obj) {
        var value = $(obj).val().trim();
        if (value != "") {
            if (isCarID(value)) {
                $(obj).removeClass("validate");
            } else {
                if (!$(obj).hasClass("validate")) {
                    $(obj).addClass("validate");
                }
            }
        } else {
            if (!$(obj).hasClass("validate")) {
                $(obj).addClass("validate");
            }
        }
        checkCanSumbit();
    }
    function checkNull(obj) {
        var value = $(obj).val().trim();
        if (value != "") {
            $(obj).removeClass("validate");
        } else {
            if (!$(obj).hasClass("validate")) {
                $(obj).addClass("validate");
            }
        }
        checkCanSumbit();
    }
    function checkCanSumbit() {
        var len = $(".contain").find(".validate").length;
        var msgValue = "";
        if (len > 0) {
            $(".contain").find(".validate").each(function () {
                msgValue = $(this).parents("li").find(".rzTitle").eq(0).text();
                return false;
            })
            api.sendEvent({
                name: 'checkSubmit',
                extra: {
                    msg: msgValue,
                    type: "canNotSumbit"
                }
            });
        } else {
            api.sendEvent({
                name: 'checkSubmit',
                extra: {
                    msg: msgValue,
                    type: "canSumbit"
                }
            });
        }

    }


    //修改头像

    function add_pic(index, max, obj) {
        api.actionSheet({
            title: '请选择图片来源',
            cancelTitle: '取消',
            buttons: ['相册选取', '相机拍摄']
        }, function (ret, err) {
//            判断是单击了那个图片上传
            type = $(obj).attr("data-type");
            if (max == 0) {
                api.toast({
                    msg: '图片已超过最多图片！',
                    duration: 1000,
                    location: 'middle'
                });
                return;
            }
            var winWidth = api.winWidth;
            var listHeight = winWidth / 3 - 12;
            if (ret.buttonIndex == 1) {
                if ((/android/gi).test(navigator.appVersion)) {
                    var album = api.require('UIMediaScanner');
                    album.open({
                        column: 3,
                        max: max,
                        sort: {
                            key: 'time',
                            order: 'desc'
                        },
                        texts: {
                            stateText: '*',
                            cancelText: '取消',
                            finishText: '完成'
                        },
                        styles: {
                            bg: '#fff',
                            mark: {
                                icon: '',
                                position: 'bottom_right',
                                size: 20
                            },
                            nav: {
                                bg: '#FF8F00',
                                stateColor: '#ffffff',
                                stateSize: 18,
                                cancleBg: '#FF8F00',
                                cancelColor: '#ffffff',
                                cancelSize: 18,
                                finishBg: '#FF8F00',
                                finishColor: '#ffffff',
                                finishSize: 18
                            }
                        },
                        exchange: true
                    }, function (ret) {
                        if (ret) {
                            var photoList = $api.byId(index);
                            var list = ret.list;
                            api.toast({
                                msg: '正在加载图片',
                                duration: 1000,
                                location: 'middle'
                            });
                            for (var i in list) {
                                var item = list[i];

                                var imgDom = $api.dom('#' + index + ' .pics[src="' + item.path + '"]');
                                //缓存图片
                                $api.setStorage("_" + index, item.path);
//                                var imgDom = $api.dom('.pics[src="' + item.path + '"]');
                                if (!imgDom) {
                                    $("#" + index).parent().find(".picGroup").hide();
                                    $api.prepend(photoList, '<li><img class="pics" src="' + item.path + '"></li>');
                                    api.parseTapmode();
                                    $(obj).parent().removeClass("validate");
                                    checkCanSumbit();
                                } else {
                                    api.toast({
                                        msg: "图片已存在"
                                    })
                                }
                            }

                        }
                    });
                } else {
                    //苹果相册
                    api.getPicture({
                        sourceType: 'album',
                        encodingType: 'jpg',
                        mediaValue: 'pic',
                        destinationType: 'url',
                        allowEdit: false,
                        quality: 60,
                        targetWidth: 300,
                        saveToPhotoAlbum: true
                    }, function (ret, err) {
                        var photoList = $api.byId(index);
                        if (ret.data) {
                            $("#" + index).parent().find(".picGroup").hide();
                            $api.prepend(photoList, '<li><img src="' + ret.data + '"><input type="hidden" id="images0" value=""></li>');

                            //缓存图片
                            $api.setStorage("_" + index, ret.data);

                            api.parseTapmode();

                            imageNum++;
                            uploadNum();
                            $(obj).parent("li.pic").removeClass("validate");
                            checkCanSumbit();
                        }
                    });
                }

            } else if (ret.buttonIndex == 2) {
                api.getPicture({
                    sourceType: 'camera',
                    encodingType: 'jpg',
                    mediaValue: 'pic',
                    destinationType: 'url',
                    allowEdit: false,
                    quality: 60,
                    targetWidth: 300,
                    saveToPhotoAlbum: true
                }, function (ret, err) {
                    var photoList = $api.byId(index);
                    if (ret.data) {
                        $("#" + index).parent().find(".picGroup").hide();
                        $api.prepend(photoList, '<li><img src="' + ret.data + '"><input type="hidden" id="images0" value=""></li>');

                        //缓存图片
                        $api.setStorage("_" + index, ret.data);

                        api.parseTapmode();
                        $(obj).parent("li.pic").removeClass("validate");
                        checkCanSumbit();
                        //uploadImage(ret.data)发布再上传
                    } else {
                        api.toast({
                            msg: "拍照操作失败，请重新操作",
                            location: 'middle'
                        })
                    }
                });
            }
        });
    }

    //更新添加图片下面的数字
    function uploadNum() {
        $(".picNum").text(imageNum);
    }
    function sendData() {

        getStorageAll();
        var data = {};
        data['userid'] = user_id;
        data['username'] = user_name//user_name;
        data['company'] = $("#companyName").val();//公司名
        data['type'] = $("#comType").text();//
        data['catid'] = categoryIds;//
        data['areaid'] = areaCityId;//
        data['mode'] = $("#modelType").text();//
        data['capital'] = $("#companyMoney").val();//
        data['regunit'] = "人民币";//
        data['size'] = $("#companyPeople").val();//
        data['regyear'] = $("#startTime").text();//
        data['sell'] = "";//
        data['buy'] = "";//
        data['business'] = $("#jingying").val();//
        data['telephone'] = $("#companyPhonne").val();//
        data['address'] = $("#address").val();//
        data['thumb'] = thumb;//
        data['bgurl'] = bgurl;//
        data['data'] = $("#comIntrol").val();//
        var url = 'Company/companyCertification';
//        alert(JSON.stringify())
        ajaxRequest(url, 'post', data, function (ret, err) {
            if (ret.status == 1) {
                hideLoading();
                api.toast({
                    msg: "已提交审核，请等待！"
                })
                api.sendEvent({
                    name: 'sendAuthentication',
                    extra: {
                        key: 'true'
                    }
                });
                setTimeout(function () {
                    closeWin();
                }, 1500)

            } else {
                hideLoading();
                api.toast({
                    msg: "提交失败，请重试！"
//                    msg:ret.msg
                })
            }
        })
    }
    function submit() {

        api.execScript({
            name: "my/comAuthentiction_win",
            script: "btnNotUnbind()"
        })
        if (!isPhoneNo($("#companyPhonne").val())) {
            api.toast({
                msg: "请输入正确电话号码"
            })
            $("#companyPhonne").focus();
            return false;
        } else if ($("#comIntrol").val().length < 10) {
            api.toast({
                msg: "介绍不能少于10个字"
            })
            $("#comIntrol").focus();
            return false;
        } else {

            showLoading();
            imageLen = $(".picList").find("img").length;
            $(".picList").find("img").each(function (index) {
                //先一张一张循环上传主图，上传完主图在上传详情图
                imgType = $(this).parent().parent().attr("id");
                uploadImage($(this).attr("src"), index, imgType);
            })
        }
    }

    // 上传图片
    /**
     *
     * @param imgPath  图片的本地地址
     * @param index 标记下标上传服务器
     */
    function uploadImage(imgPath, index, imgType) {
        var img = new Image();
        img.src = imgPath;
        //图片路径
        img.onload = function () {
            //生成比例
            var w = this.width, h = this.height, scale = w / h;
            w = 640 || w;
            h = w / scale;
            //生成canvas
            var canvas = document.createElement('canvas');
            var ctx = canvas.getContext('2d');
            $api.attr(canvas, 'width', '' + w + '');
            $api.attr(canvas, 'height', '' + h + '');
            ctx.drawImage(this, 0, 0, w, h);
            var base64 = canvas.toDataURL('image/jpeg');
            getStorageAll();
            //上传图片
            var upData = {
                userName: user_name,
                base64: base64,
            }
            var url = 'Mall/imageUpload';
            ajaxRequest(url, 'post', upData, function (ret, err) {
//                alert(imageNum);
                if (ret.status == 1) {
                    imageSendIndex++;
                    if (imgType == "logo-upload") {
                        thumb = ret.msg;
                    } else {
                        bgurl = ret.msg;

                    }
                    if (imageSendIndex == imageLen) {
                        sendData();
                    }
                    return ret.msg

                } else {
                    //$api.remove($api.dom('.li_pics[data-src="' + imgPath + '"]'));
                    api.toast({
                        msg: "上传图片出错"
                    })
                }
            })
        }
    }

    function chooseComType(obj) {
        api.actionSheet({
            title: "选择公司类型",
            buttons: ['企业单位', "事业单位或社会团体", "个体经营", "其他"]
        }, function (ret, err) {

            if (ret.buttonIndex == 1) {
                comType = '企业单位';
                $(obj).removeClass("validate");
            } else if (ret.buttonIndex == 2) {
                comType = '事业单位或社会团体';
                $(obj).removeClass("validate");

            } else if (ret.buttonIndex == 3) {
                comType = '个体经营';
                $(obj).removeClass("validate");

            } else if (ret.buttonIndex == 4) {
                comType = '其他';
                $(obj).removeClass("validate");

            } else {
                return false;
            }
            $(obj).addClass("colorBlack");
            $("#comType").text(comType);
            $api.setStorage("_comType", comType);

        });
    }
    function chooseModel(obj) {

        api.actionSheet({
            title: "选择经营模式",
            buttons: ['制造商', "贸易商", "服务商", "其他机构"]
        }, function (ret, err) {

            if (ret.buttonIndex == 1) {
                modelType = '制造商';
                $(obj).removeClass("validate");
            } else if (ret.buttonIndex == 2) {
                modelType = '贸易商';
                $(obj).removeClass("validate");

            } else if (ret.buttonIndex == 3) {
                modelType = '服务商';
                $(obj).removeClass("validate");

            } else if (ret.buttonIndex == 4) {
                modelType = '其他机构';
                $(obj).removeClass("validate");

            } else {
                return false;
            }

            $(obj).addClass("colorBlack");
            $("#modelType").text(modelType);
            $api.setStorage("_modelType", modelType);

        });
    }
    //mui插件
    function openToChoose(obj) {
        var type = $(obj).attr("id");
        api.openFrame({
            bgColor: 'rgba(0,0,0,0)',
            name: 'choose',
            url: 'comAuthentictionPopup_frm.html',
            bounces: false,
            rect: {
                x: 0,
                y: 0,
                w: 'auto',
                h: 'auto'
            },
            pageParam: {
                type: type
            }
        });
    }
    //选择主营行业
    function openCategoryList() {

    }
</script>
</html>